{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.int64\n",
      "torch.float32\n",
      "torch.int64\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\DELL\\AppData\\Local\\Temp\\ipykernel_2212\\3898301991.py:5: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n",
      "  a_float = torch.tensor(a1, dtype=torch.float32)\n",
      "C:\\Users\\DELL\\AppData\\Local\\Temp\\ipykernel_2212\\3898301991.py:6: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n",
      "  a_int64 = torch.tensor(a1, dtype=torch.int64)\n"
     ]
    }
   ],
   "source": [
    "import torch\n",
    "\n",
    "a = [1, 2, 3, 4]\n",
    "a1 = torch.tensor(a)\n",
    "a_float = torch.tensor(a1, dtype=torch.float32)\n",
    "a_int64 = torch.tensor(a1, dtype=torch.int64)\n",
    "\n",
    "print(a1.dtype)\n",
    "print(a_float.dtype)\n",
    "print(a_int64.dtype)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "torch_hwzhao",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
